<template>
    <Form
            :form-items="formItems"
    ></Form>
</template>

<script>
    import Form from '../../../../../common-util/src/components/page/Form.vue'
    export default {
        components:{
            Form
        },
        data(){
            return {
                formItems:[
                    {
                        field: {
                            name: 'appCode'
                        },
                        element:{
                            type: 'select',
                            select:{
                                url: this.$baseURL.wx + '/wx/mp/config/list',
                                optionProp:{
                                    value: 'appCode',
                                    label: 'appName'
                                }
                            },
                            required: true,
                            label: '公众号',
                        }
                    },
                    {
                        field: {
                            name: 'name'
                        },
                        element:{
                            label: '名称',
                        }
                    },
                    {
                        field: {
                            name: 'matchFromUser'
                        },
                        element:{
                            label: '匹配接收人',
                            placeholder: '消息发送人的openId',
                        }
                    },
                    {
                        field: {
                            name: 'matchMsgTypeDictId'
                        },
                        element:{
                            type: 'selectDict',
                            selectDict: {
                                groupCode: 'wx_mp_push_xml_msg_type'
                            },
                            label: '匹配消息类型'
                        }
                    },
                    {
                        field: {
                            name: 'matchEventTypeDictId'
                        },
                        element:{
                            type: 'selectDict',
                            selectDict: {
                                groupCode: 'wx_mp_push_event_type'
                            },
                            label: '匹配事件类型'
                        }
                    },
                    {
                        field: {
                            name: 'matchEventKey'
                        },
                        element:{
                            label: '匹配事件key',
                            placeholder: '配置的事件key'
                        }
                    },
                    {
                        field: {
                            name: 'matchEventKeyMatchDictId'
                        },
                        element:{
                            type: 'selectDict',
                            selectDict: {
                                groupCode: 'match_type'
                            },
                            label: '匹配event_key的匹配方式',
                            required: (form)=>{return !!form.matchEventKey}
                        }
                    },
                    {
                        field: {
                            name: 'matchContent'
                        },
                        element:{
                            label: '匹配内容'
                        }
                    },
                    {
                        field: {
                            name: 'matchContentMatchDictId'
                        },
                        element:{
                            type: 'selectDict',
                            selectDict: {
                                groupCode: 'match_type'
                            },
                            label: '匹配内容的匹配方式',
                            required: (form)=>{return !!form.matchContent}
                        }
                    },
                    {
                        field: {
                            name: 'replyMsgTypeDictId'
                        },
                        element:{
                            type: 'selectDict',
                            selectDict: {
                                groupCode: 'wx_mp_push_xml_msg_type'
                            },
                            label: '回复的消息类型',
                            required: true
                        }
                    },
                    {
                        field: {
                            name: 'replyContent'
                        },
                        element:{
                            label: '回复内容',
                            required: true
                        }
                    },
                    {
                        field: {
                            name: 'priority',
                            value: 10
                        },
                        element:{
                            type: 'inputNumber',
                            label: '优先级',
                            required: true
                        }
                    },
                    {
                        field: {
                            name: 'remark'
                        },
                        element:{
                            label: '备注'
                        }
                    },
                    {
                        element:{
                            type: 'button',
                            button:[
                                {
                                    action: 'submit',
                                    requestMethod:'post',
                                    url: this.$baseURL.wx + '/wx/mpmsgreply',
                                    label: '保存'
                                },
                                {
                                    action: 'reset',
                                    label: '重置',
                                    type: 'default'
                                }
                            ]
                        }
                    }
                ]
            }
        },
        methods:{
        }
    }
</script>

<style scoped>

</style>